package january.test_1_22;

import java.util.Scanner;

public class TestMain2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str1 = scanner.nextLine();
        String str2 = scanner.nextLine();
        int[] hash = new int[200];
        for(int i = 0; i < str1.length(); i++) {
            hash[str1.charAt(i)]++;
        }
        for(int i = 0; i < str2.length(); i++) {
            if(hash[str2.charAt(i)] != 0) {
                hash[str2.charAt(i)] = 0;
            }
        }
        for(int i = 0; i < str1.length(); i++) {
            if(hash[str1.charAt(i)] != 0) {
                System.out.print(str1.charAt(i));
            }
        }
    }
}
